import { defHttp } from '/@/utils/http/axios';
import { IGetFileDownloadQuery } from '/@/types/file/download';
import { IPostFileUploadQuery, IPostFileUploadResponse } from '/@/types/file/upload';
import { IPostFileUploadsQuery, IPostFileUploadsResponse } from '/@/types/file/uploads';

/**
 * 下载文件
 */
export const apiGetFileDownloadQuery = (params: IGetFileDownloadQuery) => defHttp.get({ url: `/file/download`, params }, { joinParamsToUrl: true });
/**
 * 删除文件
 */
export const apiGetFileRemovePath = (fileid: string | number) => defHttp.get({ url: `/file/remove/${fileid}` });
/**
 * 单个上传文件
 */
export const apiPostFileUploadQuery = (params: IPostFileUploadQuery) =>
  defHttp.post<IPostFileUploadResponse>({ url: `/file/upload`, params }, { joinParamsToUrl: true });
/**
 * 多个上传文件
 */
export const apiPostFileUploadsQuery = (params: IPostFileUploadsQuery) =>
  defHttp.post<IPostFileUploadsResponse>({ url: `/file/uploads`, params }, { joinParamsToUrl: true });
